package com.wlc.mapper;

import com.wlc.pojo.Resignation;
import com.wlc.pojo.ResignationStats;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;

@Mapper
public interface ResignationMapper {

    // 基础CRUD操作
    Resignation selectById(Long id);
    List<Resignation> selectList(Resignation resignation);
    int insert(Resignation resignation);
    int update(Resignation resignation);
    int deleteById(Long id);

    // 状态更新操作
    int updateStatus(@Param("id") Long id, @Param("status") Integer status);
    int approveResignation(@Param("id") Long id, @Param("approverId") Long approverId,
                           @Param("approvalOpinion") String approvalOpinion);
    int rejectResignation(@Param("id") Long id, @Param("approverId") Long approverId,
                          @Param("approvalOpinion") String approvalOpinion);

    // 统计查询
    List<ResignationStats> selectDeptResignationStats(@Param("year") String year);
    List<ResignationStats> selectMonthlyResignationTrend(@Param("year") String year);
    List<ResignationStats> selectResignReasonStats(@Param("year") String year);
    List<ResignationStats> selectResignationStatusStats(@Param("year") String year);
    ResignationStats selectResignationSummary(@Param("year") String year);

    // 检查员工是否存在待处理的辞职申请
    boolean existsPendingResignation(Long employeeId);
}